<div class="content">
	<div class="tab_bar">
		<ul>
			<li class="tab_index" onclick="setTabContent(this);">分类管理</li>
		</ul>
		<button class="btn_tabbar" action="category/add.do" onclick="refreshContentByElement(this);">添加分类</button>
	</div>
	<div class="tab_content">
		<div class="tab_item tab_show">
			<table class="table_for_list">
				<thead>
				  <tr>
			        <th width="60">编号</th>
			        <th width="60">根节点</th>
			        <th>类别名称</th>
			        <th width="160">别名</th> 
			        <th width="80">排序</th>
			        <th width="90">操作</th> 
			      </tr>
				</thead>
			    <tbody>
				  	<@categoryTree id = 0 node = -1 />
				</tbody>
			</table>
		</div>
	</div>
</div>



<script type="text/javascript">
 

</script>



<#macro categoryTree id node>
	<#local temp = node + 1 />
	<#list data as x>
	  	<#if id == x.pid>
	  	<#if x.root==1><tr style="background:#fbfbfb"><#else><tr></#if>
	        <td>${x.id?c} </td>
	        <td><#if x.root==1><b>${x.modelName!}</b></#if></td>
	        <td>
	        	<#if temp gt 0 ><#list 1..temp as i>&nbsp; &nbsp;</#list>┆┄</#if> 
	         	${x.name!} 
	        </td>
	        <td>${x.alias!}</td> 
	        <td>${x.sort?c} </td>
	        <td style="text-align: center;">
	        	<a href="#" action="category/edit.do?id=${x.id?c}" onclick="refreshContentByElement(this);">编辑</a>  |  
			 	<a href="#" action="category/delete.do?id=${x.id?c}"  return="category/list.do" onclick="deleteById(this)">删除</a>   
	        </td> 
	    </tr>
	    <@categoryTree id = x.id node=temp/>
      </#if>
	</#list> 
</#macro>